/********************************************************************************
* File Name:	mainwindow.cpp
* Description:	第3章 实例16：SpinBox、Double  SpinBox和Slider的实例
* Reference book:《Linux环境下Qt4图形界面与MySQL编程》，机械工业出版社.2012.1
* E_mail: openlinux2011@gmail.com
*
********************************************************************************/
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QSpinBox>
#include <QVBoxLayout>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    connect(ui->doubleSpinBox,SIGNAL(valueChanged(double)),this,SLOT(slotDoubleSpinbox_Slider()));
    connect(ui->horizontalSlider_2,SIGNAL(valueChanged(int)),this,SLOT(slotSlider_DoubleSpinbox()));
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::slotDoubleSpinbox_Slider()
{
    ui->horizontalSlider_2->setValue((int)(ui->doubleSpinBox->value()*100));
}
void MainWindow::slotSlider_DoubleSpinbox()
{
    ui->doubleSpinBox->setValue((double)(ui->horizontalSlider_2->value())/100);
}
